package cn.tedu.pool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class BlockingQueueTest1 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<Integer> queue =
                new ArrayBlockingQueue<>(3);
        queue.put(100);
        queue.put(200);
        queue.put(300);
        System.out.println(queue);//100,200,300
        //queue.put(400);//队列满了则阻塞等待
        //System.out.println(queue);
        Integer take1 = queue.take();
        Integer take2 = queue.take();
        Integer take3 =queue.take();
        System.out.println(queue);
        queue.take();
        System.out.println(queue);
    }
}
